[Step 10][SourceTree] Save unfinished changes with stash - Yellow-Team-Millerslab/GitPlayground GitHub Wiki

Equivalent in HG: Shelve

Use Case: Temporarily shelves (or stashes) changes you've made to your working copy so you can work on something else, and then come back and re-apply them later on. ref

Note: This feature is still backlogging in VS2017

Currently, we have 2 branches under test. Checkout one of them.

  1. Edit readme.md and in SourceTree, click Stash on top

  2. It will pop up a modal. Enter the message you like and click ok.

  3. Now your File Status should show no file changes, and there is one record in STASHES on left

  4. (optional) Switch to the other branch and make a commit and switch back.

  5. Right-click on the stash record in STASHES and click Apply Stash...

  6. Check File Status, readme.md file should have the same change you made before.

The whole process:

Relate commands:

  • git stash
  • git stash -u
  • git stash save
  • git stash save -u
  • git stash list
  • git stash pop
  • git stash apply
  • git stash pop "stash@{id}"
  • git stash apply "stash@{id}"
  • git stash drop "stash@{id}"
  • git stash clear